FROM dorowu/ubuntu-desktop-lxde-vnc:focal

# ENV http_proxy http://192.168.1.1:1082
# ENV https_proxy http://192.168.1.1:1082

# 下载
RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add -
RUN apt-get update -qq \
	&&  apt-get purge -y -qq google-chrome-stable \
	&&  apt-get upgrade -y -qq

# 设置“区域”和“时区”
RUN echo 'tzdata tzdata/Areas select Asia' | debconf-set-selections
RUN echo 'tzdata tzdata/Zones/Asia select Chongqing' | debconf-set-selections
RUN DEBIAN_FRONTEND="noninteractive" apt install -y tzdata

# 安装编译FriendlyElec开发板所需的软件包
RUN apt-get -y install texinfo git
RUN git clone https://gitee.com/FunXiaoYuZhou/build-env-on-ubuntu-bionic.git
RUN chmod 755 build-env-on-ubuntu-bionic/install.sh
RUN build-env-on-ubuntu-bionic/install.sh
RUN rm -rf build-env-on-ubuntu-bionic
RUN update-alternatives --install $(which python) python /usr/bin/python2.7 20
RUN git clone https://gitee.com/FunXiaoYuZhou/git-repo.git
RUN cp repo/repo /usr/bin/

# Set repo
# 1.先创建个文件夹，隐藏的
#RUN sudo mkdir ~/bin
# 设置下权限
#RUN sudo chmod 777 ~/bin
# 2.环境变量配置一下
#RUN PATH=~/bin:$PATH
# 3.使用镜像下载repo
#使用清华大学镜像
#RUN curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo
# 设置执行权限
#RUN chmod a+x ~/bin/repo

# 安装其他所需的软件包
RUN apt-get install -y --no-install-recommends -qq \
	software-properties-common locales \
	nano bash-completion lxtask openssh-server xdotool filezilla putty dnsutils \
	papirus-icon-theme fonts-noto-cjk fonts-noto-cjk-extra obconf lxappearance-obconf vim terminator tree rsync \
    poppler-utils shared-mime-info mime-support
RUN	apt-get clean

# 配置python默认版本
#RUN sudo mv /usr/bin/python /usr/bin/python_back
#RUN sudo ln -s /usr/bin/python3 /usr/bin/python

# 配置git信息 
# 邮箱和姓名可以用真实的，也可以随便编一个
# 有可能会出现不存在ubuntu文件夹的错误
RUN mkdir /home/ubuntu
RUN git config --global user.email "you@example.com"
RUN git config --global user.name "Your Name"

# 自定义:删除未使用的，更改设置，复制配置文件
COPY files /

# SSHD运行错误修复
RUN mkdir -p /run/sshd

# 修复编译 AOSP (Android 8.1) 时出现的问题:与Jack服务的通信错误(35) 
RUN sed 's/^\(jdk.tls.disabledAlgorithms=.*\)\(TLSv1, TLSv1.1, \)/\1/g' /etc/java-8-openjdk/security/java.security -i
